package fhp.hlhj.giantfold.activity.malls

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebViewClient
import fhp.hlhj.giantfold.BaseActivity
import fhp.hlhj.giantfold.R
import kotlinx.android.synthetic.main.activity_jd_code_aty.*

class JdCodeAty : BaseActivity() {
    private var html="<html>\n" +
            "\n" +
            "\t<head>\n" +
            "\t\t<meta charset=\"UTF-8\">\n" +
            "\t\t<title></title>\n" +
            "\t\t<script src=\"js/jquery-1.7.2.js\"></script>\n" +
            "\t</head>\n" +
            "\n" +
            "\t<body>\n" +
            "\t\t<script>\n" +
            "\t\t\tfunction checkPlatform() {\n" +
            "\t\t\t\tif(/android/i.test(navigator.userAgent)) {\n" +
            "\t\t\t\t\tdocument.write(\"This is Android'browser.\"); //这是Android平台下浏览器\n" +
            "\t\t\t\t}\n" +
            "\t\t\t\tif(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {\n" +
            "\t\t\t\t\tdocument.write(\"This is iOS'browser.\"); //这是iOS平台下浏览器\n" +
            "\t\t\t\t}\n" +
            "\t\t\t\tif(/Linux/i.test(navigator.userAgent)) {\n" +
            "\t\t\t\t\tdocument.write(\"This is Linux'browser.\"); //这是Linux平台下浏览器\n" +
            "\t\t\t\t}\n" +
            "\t\t\t\tif(/Linux/i.test(navigator.platform)) {\n" +
            "\t\t\t\t\tdocument.write(\"This is Linux operating system.\"); //这是Linux操作系统平台\n" +
            "\t\t\t\t}\n" +
            "\t\t\t\tif(/MicroMessenger/i.test(navigator.userAgent)) {\n" +
            "\t\t\t\t\tdocument.write(\"This is MicroMessenger'browser.\"); //这是微信平台下浏览器\n" +
            "\t\t\t\t}\n" +
            "\t\t\t}\n" +
            "\t\t\t\$(document).ready(function() {\n" +
            "\t\t\t\talert(navigator.platform);\n" +
            "\t\t\t\tcheckPlatform();\n" +
            "\t\t\t});\n" +
            "\t\t</script>\n" +
            "\t</body>\n" +
            "\n" +
            "</html>"
    override fun getContentId(): Int {
        return R.layout.activity_jd_code_aty
    }

    override fun initView() {

        webView.settings.javaScriptEnabled=true
        webView.settings.javaScriptCanOpenWindowsAutomatically = true
        webView.webViewClient=object : WebViewClient(){

        }
        webView.loadUrl(html)
    }

}

/*
* <html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery-1.7.2.js"></script>
	</head>

	<body>
		<script>
			function checkPlatform() {
				if(/android/i.test(navigator.userAgent)) {
					document.write("This is Android'browser."); //这是Android平台下浏览器
				}
				if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
					document.write("This is iOS'browser."); //这是iOS平台下浏览器
				}
				if(/Linux/i.test(navigator.userAgent)) {
					document.write("This is Linux'browser."); //这是Linux平台下浏览器
				}
				if(/Linux/i.test(navigator.platform)) {
					document.write("This is Linux operating system."); //这是Linux操作系统平台
				}
				if(/MicroMessenger/i.test(navigator.userAgent)) {
					document.write("This is MicroMessenger'browser."); //这是微信平台下浏览器
				}
			}
			$(document).ready(function() {
				alert(navigator.platform);
				checkPlatform();
			});
		</script>
	</body>

</html>
*/
